SSIS: Logging message in Script task

Categories: Database; Tagged with: ; @ October 24th, 2012 15:24

The Script task can use the Log method of the Dts object to log user-defined data. If logging is enabled, and the ScriptTaskLogEntry event is selected for logging on the Details tab of the Configure SSIS Logs dialog box, a single call to the Log method stores the event information in all the log providers configured for the task.

Pre-condition:
Loging is enabled and ScriptTaskLogEntry is selected:

image

Loging code:

 


Dim emptyBytes(0) As Byte
Dts.Log("TotalRecords: " + Dts.Variables("User::NoForCheck").Value.ToString, 0, emptyBytes)


'Error:
Dts.Events.FireError(0, "", "Can not find the source file!", "", 0)
Dts.TaskResult = Dts.Results.Failure
Return

Log:

User:ScriptTaskLogEntry,,,24/10/2012 3:16:22 PM,24/10/2012 3:16:22 PM,0,0×00,TotalRecords: 27

API:
Logging in the Script Task
http://msdn.microsoft.com/en-us/library/ms136131.aspx#Y272

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.